﻿using NewsReader.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NewsReader.ViewModels
{
    public sealed class UserFeedConfig : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private readonly FeedConfig _fc;
        private string _customCategory;
        private bool _isSelected;

        public UserFeedConfig(FeedConfig feedConfig, bool isSelected)
        {
            _fc = feedConfig;
            _isSelected = isSelected;
        }

        public String Title
        {
            get { return _fc.Title; }
        }

        public string Uri
        {
            get { return _fc.Uri; }
        }

        public String Category
        {
            get { return _customCategory == null ? _fc.Category : _customCategory; }
            set { _customCategory = value;}
        }

        public bool IsSelected
        {
            get { return _isSelected; }
            set { this.ViewModelPropertyChanged("IsSelected", value, ref _isSelected, PropertyChanged); }
        }
    }
}
